import { BroadCastCall } from "../../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../../Framework/MQ/MessageBlock";
import { NetDispatcher } from "../../../../mvc/core/NetDispatcher";
import { ServerCommand } from "../../../mvc/ServerCommand";
//class CopyLeftCopyCommand
    
    export  class CopyLeftCopyCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            super.call(arg1);
            _cache.copy.process = 0;
            if (_cache.copy.isInCopy) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.Copy_LeaveCopy, _cache.copy.copyInfo);
                this.clearCopyInfos();
            }
            if (_cache.spa.isInSpa) 
            {
                _cache.spa.isInSpa = false;
                NetDispatcher.dispatchCmd(ServerCommand.SpaLeaveSpaMap, null);
            }
            if (_cache.copy.magicTowerInfo) 
            {
                NetDispatcher.dispatchCmd(ServerCommand.Copy_LeaveMagicTowerCopy, _cache.copy.magicTowerInfo);
                _cache.copy.magicTowerInfo = null;
            }
            if (_cache.arena.isInArenaCopy) 
            {
                _cache.arena.isInArenaCopy = false;
            }
            if (_cache.arenaCross.isInArenaCrossCopy) 
            {
                _cache.arenaCross.isInArenaCrossCopy = false;
                NetDispatcher.dispatchCmd(ServerCommand.ArenaCrossLeaveCopy, null);
            }
            return;
        }

        /* internal  */clearCopyInfos(): void
        {
            if (_cache.copy.isInSixtyCopy()) 
            {
                _cache.copy.sixtyCopyItems = [];
                _cache.copy.sixtyMaterialDic = new Map<any, any> /* flash.utils.Dictionary */();
            }
            _cache.copy.copyInfo = null;
            _cache.copy.isInCopy = false;
            _cache.copy.isPractice = false;
            return;
        }
    }
